import { ProFormDigit, ProFormSelect, ProFormSwitch, ProFormText } from '@ant-design/pro-form';
import { getStorageClassOptions } from './api';

export default () => {
  return (
    <>
      <ProFormText name="name" label="名称" rules={[{ required: true, message: '请填写名称' }]} />
      <ProFormDigit
        label="CPU(核, 0为共享)"
        name="max_cpu"
        min={0}
        rules={[{ required: true, message: '请填入CPU' }]}
      />

      <ProFormDigit
        label="内存(G, 0为共享)"
        name="max_memory"
        min={0}
        rules={[{ required: true, message: '请填入内存' }]}
      />
      <ProFormSelect
        name="storage_class"
        label="存储类型"
        rules={[{ required: true, message: '请选择存储类型' }]}
        request={getStorageClassOptions}
      />
      <ProFormDigit
        label="硬盘(G)"
        name="max_disk"
        min={1}
        rules={[{ required: true, message: '请填入硬盘使用量' }]}
      />
      <ProFormSwitch fieldProps={{ defaultChecked: true }} name="status" label="启用" />
    </>
  );
};
